package ica_alink

import (
	"fmt"
	"gitee.com/captials-team/ubdframe/src/common/utils"
	"time"
)

// BaseAsk 请求的基本信息
type BaseAsk struct {
	Id      string  `json:"id"`
	Version string  `json:"version"`
	Method  string  `json:"method"`
	Sys     SysItem `json:"sys"`
}

// BaseReply 响应的基本信息
type BaseReply struct {
	Id      string      `json:"id"`
	Code    int         `json:"code"`
	Version string      `json:"version"`
	Message string      `json:"message"`
	Method  string      `json:"method"`
	Data    interface{} `json:"data"`
}

type SysItem struct {
	Ack uint `json:"ack"`
}

func NewAsk(method string, version string) BaseAsk {
	return BaseAsk{
		Id:      fmt.Sprintf("%s-%d", utils.RandLetterFigureCode(6), time.Now().Unix()),
		Version: version,
		Method:  method,
		Sys:     SysItem{Ack: 1},
	}
}
